function getYears(){

    let date = new Date();
    let year  = date.getFullYear()
    let i = 1900;
    let yearsArr = [];
    for (; year >= i; year--) {
        yearsArr.push({
            value:year
        })
    }
    return yearsArr;
}

function getMonths() {
    let monthsArr = [];
    for (let i = 12;i>=1;i--){
        monthsArr.push({value:i})
    }
    return monthsArr
}

function getDays(year,month){
    let map = [
        31,28,31,30,31,30,31,31,30,31,30,31
    ];
    if(isRunnian(year)){
        map[1] = 29;
    }
    let daysArr = [];
    for (let i = 1; i < map[month - 1] + 1; i++) {
        daysArr.push({value:i})
    }
    return daysArr;
}

function isRunnian(year){
    let flag = false;
    if(year % 4 === 0){
        if(year%100 === 0){
            if( year%400 === 0 ){
                //闰年
                flag = true;
            }
        }else{
            //闰年
            flag = true;
        }
    }
    return flag;
}

export default {
    getYears,getDays,getMonths,isRunnian
}